package com.bmslz.monitorpre;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

@EnableScheduling
@SpringBootApplication
public class MonitorProbeApplication {

    @Value("${client.project.rabbitMQ.user}")
    private String user;
    @Value("${client.project.rabbitMQ.password}")
    private String password;

    public static void main(String[] args) {
        SpringApplication.run(MonitorProbeApplication.class, args);
    }


    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder builder) {
        return builder
                .basicAuthentication(user, password) // 默认用户名密码
                .build();
    }
}
